﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace lopet.Repositories
{
    public class ExponentialDistributionRepository
    {
        private double _lambda;
        private double _x;

        public static double GetLambdaGivenHalfLife(double halfLife)
        {
            return Math.Log(2) / halfLife;
        }

        public ExponentialDistributionRepository(double lambda, double x)
        {
            _lambda = lambda;
            _x = x;
        }

        public double CDF(double x)
        {
            return 1 - Math.Exp(-1 * _lambda * x);
        }

        public double InvCDF(double p)
        {
            return Math.Log(1 - p) / (-1 *_lambda);
        }
    }
}
